// Copyright 2015 Cubane Canada, Inc.  All rights reserved.
// See LICENSE for details.

/*---
info: |
 ES6 spec 'get [Symbol.species]'
es6id: 21.2.4.2, 22.1.2.5, 22.2.2.4, 23.1.2.2, 23.2.2.2
author: Sam Mikes
description: Symbol.species getters have defined names
features: [Symbol.species]
---*/

function Test() {
    function getGetterName(obj, name) {
      var getter = Object.getOwnPropertyDescriptor(obj, Symbol.species).get;
      return getter && getter.name;
    }

    assert.sameValue(getGetterName(Array, Symbol.species), "get [Symbol.species]");
    assert.sameValue(getGetterName(Map, Symbol.species), "get [Symbol.species]");
    assert.sameValue(getGetterName(Promise, Symbol.species), "get [Symbol.species]");
    assert.sameValue(getGetterName(RegExp, Symbol.species), "get [Symbol.species]");
    assert.sameValue(getGetterName(Set, Symbol.species), "get [Symbol.species]");
}

// preheat
const NUMBER_OF_PREHEAT = 1;
for (let i = 0; i < NUMBER_OF_PREHEAT; i++) {
    Test();
}

ArkTools.jitCompileAsync(Test);
assert.sameValue(ArkTools.waitJitCompileFinish(Test), true, '[JIT] JIT disabled.');

// test
const NUMBER_OF_TEST = 1; // or 2
for (let i = 0; i < NUMBER_OF_PREHEAT; i++) {
    Test();
}
